<!-- 娃娃详情 -->
<template>
  <div class="detail-box" v-if="show">
    <div class="doll-detail">
        <ul class="header">
            <li :class="{selected: selected == 0}" @click="getDollDetail">娃娃详情</li>
            <li></li>
            <li :class="{selected: selected == 1}" @click="getCatchLog">抓取记录</li>
        </ul>
        <div class="content image" v-if="selected == 0">
            <img :src="image" class="detail-image">
        </div>
        <div class="content log" v-if="selected == 1">
            <consume source="room" :id="id"></consume>
        </div>
        <div class="close-btn" @click="setHide"></div>
    </div>
    <div class="mask" v-if="show"></div>
  </div>
</template>

<script>
import api from "@/assets/js/api";
import consume from "@/pages/user-center/consume";
export default {
  name: "doll-detail",
  data() {
    return {
      selected: 0
    };
  },
  props: ["show", "image", "id"],
  components: {
      consume
  },

  mounted() {},

  methods: {
    getDollDetail() {
      this.selected = 0;
    },
    getCatchLog() {
      this.selected = 1;
    },
    setHide(e) {
      e.stopPropagation();
      this.$emit("cancelDetail");
    }
  }
};
</script>
<style lang='less' scoped>
.doll-detail {
  width: 6.3rem;
  height: 8.78rem;
  background: #ffb52b;
  border-radius: 0.2rem;
  box-sizing: border-box;
  position: fixed;
  left: 50%;
  top: 50%;
  margin: -5.2rem 0 0 -3.15rem;
  padding: 0 0.3rem 0.3rem;
  z-index: 1011;
  .header {
    height: 1.06rem;
    padding-top: 0.3rem;
    display: flex;
    justify-content: space-around;
    text-align: center;
    li {
      width: 1.3rem;
      height: 0.52rem;
      color: #ffda64;
      font-size: 0.3rem;
      border-bottom: 0.04rem solid #ffb52b;
      white-space: nowrap;
      &.selected {
        color: #fff;
        border-color: #fff;
      }
    }
    li:nth-of-type(2) {
      width: 0.02rem;
      height: 0.26rem;
      background: #ffda64;
      border: none;
      margin-top: 0.1rem;
    }
  }
  .content {
    height: 7.42rem;
    background-color: #fff;
    border-radius: 0.2rem;
    &.image {
        overflow: scroll;
        padding: 0;
    }
    &.log {
        overflow: scroll;
        margin: 0;
        &::-webkit-scrollbar {
          width: 0;
          height: 0;
        }
    }
    .detail-image {
      width: 100%;
      object-fit: cover;
      float: left;
    }
  }
  .close-btn {
    width: 6.3rem;
    position: absolute;
    left: 0;
    bottom: -1.75rem;
    background: url("../assets/images/close-btn.png") no-repeat center top;
    background-size: contain;
    height: 1.75rem;
    line-height: 0.88rem;
    font-size: 0.28rem;
    color: #555;
    text-align: center;
  }
}
.mask {
  position: fixed;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  left: 0;
  top: 0;
  z-index: 1010;
}
</style>
